layui.define(['table', 'form'], function(exports){
	var $ = layui.$
		,admin = layui.admin
		,view = layui.view
		,table = layui.table
		,form = layui.form;

	//`id`, `group_id`, `type`, `username`, `nickname`, `password`, `salt`, `email`, `mobile`, `checkmail`, `checkmobile`, `avatar`, `truename`, `level`, `gender`, `birthday`, `bio`, `money`, `coin`, `score`, `rankscore`, `loginnum`, `logintime`, `loginip`, `loginfailure`, `recommendemail`, `parentid`, `joinip`, `createtime`, `updatetime`, `deletetime`, `status`) VALUES

	table.render({
		elem: '#LAY-user-back-manage'
		,url: './seller/list' //模拟接口'id,nickname,email,gender,money,coin,createtime,logintime,loginnum,status'
		,cols: [[
			{type: 'checkbox', fixed: 'left'}
			,{field: 'id', width: 80, title: 'ID', sort: true}
			,{field: 'nickname', title: '昵称'}
			,{field: 'email', title: '邮箱'}
			,{field: 'gender', title: '性别'}
			,{field: 'money', title: '本金', sort: true}
			,{field: 'coin', title: '佣金'}
			,{field: 'createtime', title: '注册时间', sort: true}
			,{field: 'logintime', title: '最近登陆'}
			,{field: 'loginnum', title: '登陆次数'}
			,{field: 'status', title:'状态', templet: '#buttonTpl', minWidth: 80, align: 'center'}
			,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-useradmin-admin'}
		]]
		,text: '对不起，加载出现异常！'
		,page: true
	});

	//工具条
	table.on('tool(LAY-user-back-manage)', function(obj){
		var data = obj.data;
		if(obj.event === 'del'){
			layer.confirm('确定删除？', function(index){
				console.log(data);

				//提交 Ajax 成功后，关闭当前弹层并重载表格
				admin.req({
					url: './seller/del'
					,type: 'post'
					,data: {id:data.id}
					,done: function(res){
						obj.del();
						layer.close(index);
					}
				});


			});

		}
	});

	exports('seller', {})
});